/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.lucava.boatskeeper.client.event;

import com.google.gwt.event.shared.GwtEvent;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author glenn
 */
public class ErrorEvent extends GwtEvent<ErrorHandler> {

    public static GwtEvent.Type<ErrorHandler> TYPE = new GwtEvent.Type<ErrorHandler>();
    private List<String> messages;

    public ErrorEvent() {
        this.messages = new ArrayList<String>();
    }

    public ErrorEvent(List<String> messages) {
        this.messages = messages;
    }

    public List<String> getMessages() {
        return messages;
    }

    @Override
    public Type<ErrorHandler> getAssociatedType() {
        return TYPE;
    }

    @Override
    protected void dispatch(ErrorHandler handler) {
        handler.onError(this);
    }
}
